<?php
require_once('../../../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
require_once('../../lib/libtablas.php.inc');
verificar_inicio_sesion();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/sybmasstyle.css">
<script src="<?php echo LAYOUT_URI?>/jquery-1.2.1.min.js"
	type="text/javascript"></script>
<script src="<?php echo LAYOUT_URI?>/menu-collapsed.js"
	type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
	href="<?php echo LAYOUT_URI?>/style.css" >
<link rel="stylesheet" type="text/css"
	href="<?php echo JAVASCRIPT_URI?>/tabs/tabs.css">
<script src="<?php echo JAVASCRIPT_URI?>/tabs/tabs.js"
	type="text/javascript"></script>
<script type="text/javascript" src="<?php echo JAVASCRIPT_URI?>/commons.js">></script>
<script src="<?php echo JAVASCRIPT_URI?>/validacionFormularios.js"
	type="text/javascript"></script>
<script type="text/javascript" src="agregar.js"></script>
<title>.:: Sybmas - Agregar columna</title>
<!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
   </style>
   <![endif]-->
</head>
<body onload="setProperties('<?php echo IMG_URI?>')">
<script src="<?php echo JAVASCRIPT_URI?>/tooltip/wz_tooltip.js"
	type="text/javascript"></script>
<div id="dialog">
<div class="title">Agregar columna</div>

<?php 
$dbname=false;
foreach($_POST as $key => $value){
	$$key=$value;
	echo "<input type='hidden' name='$key' value='$value'>\n";
}
?>
<h2>Proporcione los siguientes datos</h2>
<?php
$cambio_bd_exitoso=true;
$sybuser_connection=start_default_sybuser_connection();
if($dbname){
	$cambio_bd_exitoso=sybase_select_db($dbname,$sybuser_connection);
}

if($cambio_bd_exitoso){
	$query="SELECT t.usertype,t.name,t.length,prec,scale ".
		"FROM systypes t ".
		"ORDER BY name ASC";
	$result=@sybase_query($query,$sybuser_connection);	
?>
<form id="forma">
<table width="100%" border="1">
	<tbody>
		<tr>
			<th>nombre</th>
			<td>
				<input type="text" name="cname" id="cname" maxlength="30" 
				onkeydown="return onKeyPressPermiteAlfaNumericosNoEspacios(event)">
			</td>
		</tr>
		<tr>
			<th>tipo</th>
			<td>
				<select name="type" id="type">
				<?php 
					while($data=sybase_fetch_array($result)){
						$tname=$data['name'];
						echo "<option value='$tname'";
						echo $tname=='varchar'?' selected ':'';
						echo ">$tname</option>\n";	
					}				
				?>
				</select>
			</td>
		</tr>
		<tr>
			<th>longitud</th>
			<td>
				<input type="text" name="length" id="length" 
				maxlength="6" onblur="cambiarLongitudMaximaVDefault(this.value)">
			</td>
		</tr>
		<tr>
			<th>valor predeterminado</th>
			<td><input type="text" name="vdefault" id="vdefault" ></td>
		</tr>
		<tr>
			<th>identidad/nulos</th>
			<td>
				<input type="radio" name="identity_null" id="in_notnull" value="NOT NULL">No Nulo
				<input type="radio" name="identity_null" id="in_null"  value="NULL" checked="checked">Nulo
				<input type="radio" name="identity_null" id="in_identity" value="IDENTITY">Identidad
			</td>
		</tr>
	</tbody>
</table>
</form>
<?php 
}//if($cambio_bd_exitoso)
//Cerrando conexiones a la base de datos
sybase_close($sybuser_connection);
?>
<hr>
<input type="button" value="Continuar" onclick="addColumn()">
<input type="button" value="Cancelar" onclick="window.close()">

</div>
</body>
</html>